# Contributor: Aiden Grossman <agrossman154@yahoo.com>
# Maintainer: Aiden Grossman <agrossman154@yahoo.com>
pkgname=jupyter-notebook
pkgver=6.4.12
pkgrel=0
pkgdesc="Jupyter interactive notebook"
url="https://github.com/jupyter/notebook"
# py3-argon2-cffi is not available on s390x
# bower/npm not present on riscv64
arch="noarch !s390x !riscv64"
license="BSD-3-Clause"
depends="py3-jupyter_core
	py3-ipython_genutils
	py3-tornado
	jupyter-nbformat
	mathjax2
	jupyter-nbconvert
	py3-ipykernel
	py3-nest_asyncio
	py3-send2trash
	py3-jupyter_client
	py3-prometheus-client
	py3-jinja2
	py3-terminado
	py3-pyzmq
	py3-argon2-cffi
	py3-traitlets
	"
makedepends="bower npm py3-setuptools"
checkdepends="py3-pytest"
options="!check" # lots of unpackaged dependencies + many dependencies would only work on x86_64
source="$pkgname-$pkgver.tar.gz::https://github.com/jupyter/notebook/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/notebook-$pkgver"

# secfixes:
#   6.4.12-r0:
#     - CVE-2022-29238
#   6.4.10-r0:
#     - CVE-2022-24758

build() {
	# use system mathjax
	sed -i 's/^.*MathJax.*$//' bower.json
	sed -i 's/  mj(/  #mj(/' setupbase.py

	python3 setup.py build
}

check() {
	python3 setup.py test
}

package() {
	python3 setup.py install --prefix="/usr" --root="$pkgdir"

	# set install to use system mathjax
	ln -s /usr/share/mathjax2 "$pkgdir/usr/lib/python3.10/site-packages/notebook/static/components/MathJax"
}

sha512sums="
3cc352f8ad33108822ca95b30e112993ce407a4460a9d05928c262dbf33aafadefae2b9674c297b9065990b652ef6b8eb251820539e5b31ac0cbc5a695240e63  jupyter-notebook-6.4.12.tar.gz
"
